package com.venutech.gongan.dto.rpc.common;


public enum WorkStatus {

    InProgress(0, "审批中"),
    Approved(1, "审批通过"),
    Rejected(2, "审批驳回");

    private int value;
    private String typeName;

    WorkStatus(int value, String typeName) {
        this.typeName = typeName;
        this.value = value;
    }

    public static String getNameByValue(int value) {
        for (WorkStatus item : WorkStatus.values()) {
            if (item.getValue() == value) {
                return item.getTypeName();
            }
        }
        return "";
    }

    public static WorkStatus getUserTypeByValue(int value) {
        WorkStatus workStatus = WorkStatus.InProgress;
        if (value == WorkStatus.InProgress.getValue()) {
            workStatus = WorkStatus.InProgress;
        } else if (value == WorkStatus.Approved.getValue()) {
            workStatus = WorkStatus.Approved;
        } else if (value == WorkStatus.Rejected.getValue()) {
            workStatus = WorkStatus.Rejected;
        }

        return workStatus;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }


}
